Decentralized applications are applications that run on peer-to-peer networks, rather than on a single computer. Transactions associated with decentralized applications are typically processed by nodes (or computers) on the peer-to-peer network based on trustless protocols or a series of validation rules established by the creators of the decentralized application. A critical component of decentralized applications is the manner in which transactions associated with the decentralized application are verified and recorded.
In many decentralized applications, verified transactions and/or other information is committed to a blockchain. Many types of blockchains exist. In general, they are distributed ledgers shared by the nodes on a network to which transactions are recorded and validated. A block is a part of a blockchain, in which some or all of the recent transactions may be recorded. Once completed, a block is stored in the blockchain as a permanent database. Each time a block gets completed, a new one is generated. Each block in the blockchain is connected to the others (like links in a chain) in proper linear, chronological order. Every block contains a hash of the previous block. The blockchain has information about different user addresses and their balances right from the genesis block to the most recently completed block.
A critical component of decentralized applications are smart contracts. A smart contract can be thought of as computerized transaction protocol that executes terms of a contract. In other words, smart contracts are essentially self-executing contracts with the terms of an agreement between parties being directly written into and executed by lines of code. The code and the agreements contained therein can exist across a distributed, decentralized blockchain network. Using a scripting language or other techniques, a smart contract can include logic-based programs that run on top of a blockchain.
For most decentralized applications operating on blockchain-based systems, smart contracts are utilized to administer the decentralized application and/or one or more aspects of the decentralized application. For example, when a user generates a transaction, at least one endorsement is required. Another user (such as a banker in the case of a bank transaction) may endorse the user's transaction. This endorsed transaction may comprise a smart contract.
Typically, the most vulnerable stage of a blockchain-based system is the execution of smart contracts. In conventional blockchain-based system, the ledger embodied by the blocks of a blockchain may be accessed and modified directly by the computer (or CPU) at any node on the peer-to-peer network. In order to attack the system, a hacker may write a malicious smart contract, install it onto the system by hacking a CPU, and follow it with overflow or reentry attacks. In doing so, the hacker may take advantage of the host by essentially modifying the blockchain to their advantage. For example, attacking the system in this way may enable a hacker to withdraw a customer's balance, thus jeopardizing the security of the entire system. This vulnerability of the system is further exacerbated by the known and unknown vulnerabilities of any given CPU on the network. It would be desirable to provide systems and methods that address the privacy and security concerns associated with the execution of smart contracts in decentralized applications.